﻿using System;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace Domain_Home
{
	public abstract class DnsTools
	{
		[DllImport("dnsapi.dll",EntryPoint="DnsFlushResolverCache")]
		private static extern UInt32 DnsFlushResolverCache();

		public static void FlushDll()
		{
			DnsFlushResolverCache();
		}

		public static void FlushProcess()
		{
			var process = new Process();
			var startInfo = new ProcessStartInfo
			{
				WindowStyle = ProcessWindowStyle.Hidden,
				FileName = "cmd.exe",
				Arguments = "/C ipconfig /flushdns"
			};
			process.StartInfo = startInfo;
			process.Start();
		}
	}
}